package cn.edu.sdjzu.xg21.domain;

import java.io.Serializable;

public class Teacher implements Comparable<Teacher>, Serializable {
    public Teacher(String name,Department department){
        this.name = name;
        this.department = department;
    }
    // 查询教师信息时会用到
    public Teacher(Integer id, String name, Department department){
        this.id = id;
        this.name = name;
        this.department = department;
    }

    public void setId(int id){
        this.id = id;
    }
    public void setDepartment(Department department){
        this.department = department;
    }

    // 一定要有get方法
    public Integer getId(){
        return this.id;
    }
    public String getName(){
        return this.name;
    }
    public Department getDepartment(){
        return this.department;
    }

    @Override
    public int compareTo(Teacher o) {
        return o.id - this.id;
    }

    @Override
    public String toString(){
        final String TAB ="   ";
        return "{" + "id:" + this.id + "," + TAB +
                "name:" + this.name + "," + TAB +
                "department:" + this.department + "}\n";
    }
    private Integer id;
    private String name;
    private Department department;
}
